import json

import requests
from jsonpath import jsonpath

data ={
    "txnCommCom": {
        "txnIttChnlId": "C0071234567890987654321",
        "txnIttChnlCgyCode": "BC01C101",
        "tStsTraceId": "123"
    },
    "txnBodyCom": {
        "regnCode": '530100000000',
        "handleWay": "0"
    }
}

headers ={
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
}

response = requests.post(url='', data=str(data), headers=headers)
rjson = response.json()
print(f'rjson=response.json(),rjson的类型:{type(rjson)}')
print(f'rjson=\n{rjson}')
print('\n'*3)
sjson = json.dumps(rjson, ensure_ascii=False, indent=1)
sjson = sjson.replace('"{','{').replace('}"','}').replace(r'\"','"')
rjson = json.loads(sjson)
mylst = jsonpath(rjson, '$.C-Response-Body.list[*].orgCode')
print(mylst)

# rjson = json.loads()
# mylst = jsonpath(rjson, '$.C-Response-Body.list')
# print('\n'*3)
#
# print(rjson)
# mydic = json.loads(mylst)
# print(jsonpath(mydic, '$.[*]'))



